<!doctype html>
<html ng-app="app">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../../build/common/base.css" rel="stylesheet">
<script type="text/javascript" src="../../build/common/base.js"></script>
<script type="text/javascript" src="../../build/common/ngEdit.js"></script>
<script type="text/javascript">
	var app = angular.module('app', [ 'baseDirective']);
	app.controller("ctrl", [ '$scope', 'baseService', 'ArrayToolService', function($scope, baseService, ArrayTool) {
		$scope.ArrayTool = ArrayTool;
		
		$scope.$on("afterSaveEvent",function(event,data){
			if(!$scope.data.id){
				$scope.data.id=data.data
				parent.appendNode($scope.data);
			}
			if(data.r){
				location.reload(); 
			}
			
		});
		$scope.$on("afterLoadEvent",function(event,data){
			if(!$scope.data || !$scope.data.id){
			//	$scope.data.type ='menu';
				$scope.data.enable= 1;
				$scope.data.opened =1;
				$scope.data.sn =1;
			}
		});
		
		
	} ]);
</script>
</head>
<body ng-controller="ctrl" class="panel success">
	<div class="panel-heading">
		<a class="btn btn-sm btn-primary fa-save" ng-model="data" ab-save="/org/sysResource/save">
			<span>保存</span>
		</a>
	</div>
	<form name="form" method="post" ab-load="/org/sysResource/getJson?id={id}&systemId={systemId}&parentId={parentId}" ng-model="data">
		<table class="form-table" cellspacing="0">
			<tr>
				<th>资源名:</th>
				<td>
					<input class="form-control" type="text" ng-model="data.name" ab-validate="{required:true,maxlength:60}" />
				</td>
			</tr>
			<tr>
				<th>别名:</th>
				<td>
					<input class="form-control" type="text" placeholder="资源别名，全局唯一" ng-model="data.alias" ab-validate="{required:true,maxlength:60}" />
				</td>
			</tr>
			<tr>
				<th>请求地址:</th>
				<td>
					<input class="form-control input-width-80" type="text" ng-model="data.url" ab-validate="{required:false,maxlength:120}" />
					<span class="fa fa-question-circle btn text-danger ng-isolate-scope" ab-tip=""  title="按钮、链接需要正确配置请求链接，该链接会用于系统鉴权"></span>
				</td>
			</tr>
			<tr>
				<th>类型:</th>
				<td>
					 <select class="form-control" ng-model="data.type" ab-validate="{required:true,maxlength:120}">
					 	<option value="menu"> 菜单</option>
					 	<option value="button"> 按钮</option>
					 	<option value="link"> 链接</option>
					 </select>
				</td>
			</tr>
			<tr>
				<th>状态:</th>
				<td>
					<input type="radio" ng-model="data.enable" value="0" /> 禁用
					<input type="radio" ng-model="data.enable" value="1" /> 启用
				</td>
			</tr>
			<tr>
				<th>默认展开:</th>
				<td>
					<input type="radio" ng-model="data.opened" value="1" /> 是
					<input type="radio" ng-model="data.opened" value="0" /> 否
				</td>
			</tr>
			<tr>
				<th>字体图标:</th>
				<td>
					<input class="form-control" type="text" ng-model="data.icon" ab-validate="{required:false,maxlength:60}" />
					<span class="fa fa-question-circle btn text-info ng-isolate-scope" ab-tip=""  title="字体图标,可以在开发辅助-字体图标中选择合适的图标，按钮、链接目前不支持该配置"></span>
				</td>
			</tr>
			<tr>
				<th>排序:{{data.sn}}</th>
				<td>
					<input class="form-control input-width-5" type="text" ng-model="data.sn" ab-validate="{required:false,number:true,maxlength:10}" />
					<span class="fa fa-question-circle btn text-info ng-isolate-scope" ab-tip=""  title="默认值1，数字越大同级排序越靠后"></span>
				</td>
			</tr>
		</table>
	</form>
</body>
</html>